import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/home/home.vue'
import Index from '@/views/home/index.vue'
import Cla from '@/views/home/cla.vue'
import Cart from '@/views/home/cart.vue'
import My from '@/views/home/my.vue'
import Register from '@/views/register/register.vue'
import Login from '@/views/login/login.vue'
import Goods from '@/views/goods/goods.vue'
import Detail from '@/views/detail/detail.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {path: '/',redirect:'/home/index',},
    {path: '/home',name: 'home',component: Home,children:[
      {path: 'index',name: 'index',component: Index,},
      {path: 'cla',name: 'cla',component: Cla,},
      {path: 'cart',name: 'cart',component: Cart,},
      {path: 'my',name: 'my',component: My,},
    ]},
    {path: '/register',name: 'register',component: Register,},
    {path: '/goods/:cat_name',name: 'goods',component: Goods,},
    {path: '/login',name: 'login',component: Login,},
    {path: '/detail/:goods_id',name: 'detail',component: Detail,},
  ],
})

export default router
